package com;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class ReflectDemo4 {
    public static void main(String[] args) throws Exception {
        Class<?> c = Class.forName("com.Student");//获取类的对象通过Claaforname方法
        Constructor<?> cos = c.getConstructor();//获取无参数构造方法
        Object o = cos.newInstance();//通过newinstance方法获取类的对象
        Method m1 = c.getMethod("show");
         m1.invoke(o);
        Method m3 = c.getMethod("Method3", String.class, int.class, int.class);

        Object s = m3.invoke(o, "s", 10, 20);

        System.out.println(s);
    }
}
